Skip to content

Feature/topic reader metrics - #932

Draft
NastyaKa wants to merge 7 commits into
ydb-platform:mainfrom
NastyaKa:feature/topic-reader-metrics
Draft

NastyaKa wants to merge 7 commits into
ydb-platform:mainfrom
NastyaKa:feature/topic-reader-metrics

Conversation

@NastyaKa

Copy link
Copy Markdown

Pull request type

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

The Python SDK does not provide metrics for topic readers.

What is the new behavior?

Added the following topic reader metrics:

  • ydb.topic.reader.received.messages
  • ydb.topic.reader.received.bytes
  • ydb.topic.reader.delivered.messages
  • ydb.topic.reader.local_buffer.messages
  • ydb.topic.reader.local_buffer.message_age.max
  • ydb.topic.reader.partition_session.count

Metrics are collected for readers with an explicitly configured reader_name.

Other information

Added unit tests, documentation, and an OpenTelemetry example.

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.15226% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.03%. Comparing base (5f54777) to head (79e9ed2).

Files with missing lines Patch % Lines
ydb/observability/metrics.py 88.70% 15 Missing and 19 partials ⚠️
ydb/_topic_reader/topic_reader_asyncio.py 95.65% 6 Missing and 1 partial ⚠️
ydb/_topic_reader/topic_reader_sync.py 60.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #932      +/-   ##
==========================================
+ Coverage   82.69%   83.03%   +0.34%     
==========================================
  Files          99       99              
  Lines       12954    13373     +419     
  Branches     1266     1331      +65     
==========================================
+ Hits        10712    11104     +392     
- Misses       1790     1802      +12     
- Partials      452      467      +15     
Flag Coverage Δ
integration 80.47% <83.12%> (+0.09%) ⬆️
unit 49.78% <51.44%> (+0.51%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ydb/_grpc/grpcwrapper/ydb_topic.py 86.15% <100.00%> (+0.04%) ⬆️
ydb/_topic_reader/datatypes.py 96.89% <100.00%> (+1.35%) ⬆️
ydb/_topic_reader/topic_reader.py 91.46% <100.00%> (+0.43%) ⬆️
ydb/opentelemetry/metrics_plugin.py 96.15% <100.00%> (+0.15%) ⬆️
ydb/topic.py 86.01% <ø> (ø)
ydb/_topic_reader/topic_reader_sync.py 73.17% <60.00%> (+1.01%) ⬆️
ydb/_topic_reader/topic_reader_asyncio.py 89.53% <95.65%> (+2.55%) ⬆️
ydb/observability/metrics.py 93.15% <88.70%> (-3.25%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@NastyaKa
NastyaKa marked this pull request as draft October 30, 2026 14:16

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant